<template>
    <div>
        <table>
            <tr>
                <td>名称</td>
                <td>
                    <input type="text" v-model="data.xm">
                </td>
            </tr>
            <tr>
                <td>性别</td>
                <td>
                    <input type="text" v-model="data.xb">
                </td>
            </tr>
            <tr>
                <td>状态</td>
                <td>
                    <input type="text" v-model="data.isdelete">
                </td>
            </tr>
            <tr>
                <td>生日</td>
                <td>
                    <input type="date" v-model="data.ctime">
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input type="button" value="修改" @click="add">
                </td>
            </tr>
        </table>

    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref,onMounted } from 'vue';
import { useRoute } from 'vue-router';
var route = useRoute()

const data=ref({
    "id": 0,
  "xm": "string",
  "xb": "string",
  "ctime": "2025-03-24T12:31:51.325Z",
  "isdelete": 0
})

const qx = ()=>{
    var a = route.query.id
    axios.get("https://localhost:7261/api/hy/xq",{params:{id:a}}).then(res=>{
        data.value=res.data
    })
}
onMounted(()=>{
    qx();
})
const add=()=>{
    axios.post("https://localhost:7261/api/hy/xg",data.value).then(res=>{
        if(res.data>0){
            alert("修改成功")
            location.href="/xss"
        }else{
            alert("修改失败")
        }
    })
}
 
</script>

<style scoped>

</style>